"""
@name : 7-1.propert
@author : wenyao
@projectname: sanchuanglianxi
"""
# class A:
#     tmp = "tmp"
#
#     #@property
#     def show(self):
#         print("i am show")
#
# a = A()
# #a.show()
# #a.show
# a.tmp = "test"
# print(a.tmp)
# a.tmp = 10
# print(a.tmp)

# class Person():
#     __age = 1
#     def get_age(self):
#         return self.__age
#     def set_age(self,age):
#         if 0<age<100:
#             self.__age = age
#         else:
#             raise ValueError("年龄范围错误")
#
# p = Person()
# #print(p.__age)
# p.set_age(10)
# print(p.get_age())

# class Person():
#     _age = 10
#
#     @property  #property 本身会创建另外一个装饰器@age.setter , @age.deleter
#     def age(self):
#         return self._age
#
#     @age.setter
#     def age(self,_age):
#         if 0 < _age < 100:
#             self._age = _age
#         else:
#             raise ValueError("年龄范围错误")
#
#     @age.deleter
#     def age(self):
#         print("del....")
#         del self._age
#
# p = Person()
# p.age = 20
# print(p.age)
# #p.age1 = 90
# #print(p.age1)
# # p.age = 50
# # print(p.age)
# del (p.age)
# #print(p.age)
# print(p.age)

# class A:
#     _tmp = "a"
#
#     @classmethod
#     def __get(cls):
#         return cls._tmp
#
#     def test(self):
#        print(self.__get())

# A.test()

# class B(A):
#     # def get(self):
#     #     print(self._get())
#     print(A.__get())
#     pass

# a = A()
# a.test()
# b = B()
# print(b.tmp)
#a.tmp = 3
# del A.tmp
# print(A.tmp)
# print(a.tmp)
# print(b.tmp)

#约定即规范

class A:
    @property
    def test(self):
        return "ok"

a = A()
print(a.test)